# coding=utf-8
# 代码文件：chapter3/ch3.3.1.py
from datetime import date

import xlwings as xw
import re

# 设置程序不可见运行
app = xw.App(visible=False, add_book=False)
f = r'data/全国总人口10年数据 - 缺失值.xls'
wb = app.books.open(f)

sheet1 = wb.sheets[0]

# 获得区域，单元格为空值的则填充为0
rng = sheet1.range('B4:K8').options(numbers=int, empty=0)

# 替换区域中所有单元格内容
rng.value = rng.value

f = r'data/全国总人口10年数据 - 缺失值2.xls'
wb.save(path=f)

wb.close()
app.quit()

print('Game Over')
